<%- include('../includes/header') %>
<link rel="stylesheet" href="/css/cart.css">
</head>
<body>
    <%- include('../includes/navigation') %>
    <main>
        <% if (products.length > 0) { %>
        <ul class="cart-list">
            <% for (p of products) { %>
            <li class="cart-list-item">
                <p><%= p.title %>--<b>￥<%= p.price %></b>--<%= p.quantity %></p>
                <div class="item-toolbar">
                    <form action="/cart-delete" method="post">
                        <input type="hidden" name="prodId" value="<%= p._id %>">
                        <button class="btn">删除</button>
                    </form>
                </div>
            </li>
            <% } %>
        </ul>
        <hr>
        <h2>总价：￥<%= totalPrice %></h2>
        <div class="centered">
            <form action="/create-order" method="post">
                <button type="submit" class="btn">提交</button>
            </form>
        </div>
        <% } else { %>
        <h1>购物车里没有宝贝！！！</h1>
        <% } %>
    </main>
<%- include('../includes/end') %>